package com.qf.dao;

import com.qf.pojo.OrderDetail;
import com.qf.util.DataSourceUtil;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * @author 千锋健哥
 */
public class OrderDetailDaoImpl implements OrderDetailDao {

    private QueryRunner queryRunner = new QueryRunner(DataSourceUtil.getDataSource());

    @Override
    public void insert(OrderDetail orderDetail) {
        try {
            String sql = "insert into tb_orderdetail (oid, pid, num, money) values(?, ?, ?, ?)";
            queryRunner.update(sql, orderDetail.getOid(), orderDetail.getPid(),
                    orderDetail.getNum(), orderDetail.getMoney());
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

}
